package pta.newch04.ex02;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        Person[] persons = new Person[n];
        for (int i = 0; i <n; i++) {
            String name = scanner.next();
            int age = scanner.nextInt();
            boolean gender =scanner.nextBoolean();
            persons[i]=new Person(name,gender,age);
        }
        for (int i = n; i >=0 ; i--) {
            System.out.println(persons[i].toString());
        }
        Person p = new Person();
        System.out.println(p.name + "," + p.age + "," + p.gender + "," + p.id);
        System.out.println(p.toString());
    }
}
class Person {
    String name;
    boolean gender;
    int age;
    int id;

    private static int count = 0;

    static {
        System.out.println("This is static initialization block");
    }

    {
        id = count++;
        System.out.println("This is initialization block, id is " + id);
    }

    public Person() {
        System.out.println("This is constructor");
    }

    public Person(String name, boolean gender, int age) {
        this.name = name;
        this.gender = gender;
        this.age = age;
    }

    @Override
    public String toString() {
        return "Person [name=" + name + ", age=" + age + ", gender=" + gender + ", id=" + id + "]";
    }
}